import { Injectable } from '@angular/core';
import { Http }    from '@angular/http';
import 'rxjs/add/operator/toPromise';

export class Factory {
  constructor(argument) {
    // code...
  }
}

@Injectable()
export class  FactoryService {
  constructor(private http:Http) { 
  }
  public getByType(type) {
    return this.http.get(`/api/factory/type/${type}`)
      .toPromise()
      .then(response => {
        return response.json()
      })
  }
} 